package org.ellwood;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;

/**
 * @BelongsProject: ellwood-pro
 * @BelongsPackage: org.ellwood
 * @BelongsClass: EllwoodServerApplication
 * @Description: // 启动
 * @Author: ellwood
 * @CreateTime: 2024/1/30 - 16:03
 * @Version: V1.0.0
 */
@Slf4j
@SpringBootApplication
public class EllwoodServerApplication {

    @SneakyThrows
    public static void main(String[] args) {
        SpringApplication app=new SpringApplication(EllwoodServerApplication.class);
        ConfigurableApplicationContext application=app.run(args);
        Environment env=application.getEnvironment();
        log.info(
                "\n Ellwood管理系统启动成功！！ \n" +
                        "----------------------------------------------------------\n\t" +
                        "Application '{}' is running! Access URLs:\n\t" +
                        "Local: \t\thttp://localhost:{}\n\t" +
                        "External: \thttp://{}:{}\n\t"+
                        "Doc: \thttp://{}:{}/doc.html\n"+
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port")
        );
    }

}
